package jhunter.web.mvc.params;

import java.util.Enumeration;
import java.util.HashMap;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class SessionMap extends HashMap<String, Object> {

	private static final long serialVersionUID = 5163548480617376757L;

	public SessionMap(HttpServletRequest request) {
		HttpSession session = request.getSession(false);
		if (session != null) {
			@SuppressWarnings("rawtypes")
			Enumeration en = session.getAttributeNames();
			while (en.hasMoreElements()) {
				String name = (String) en.nextElement();
				Object value = session.getAttribute(name);
				super.put(name, value);
			}
		}

	}
}
